/**
 @file ctc_tmx_flexe.h

 @author  Copyright (C) 2018 Centec Networks Inc.  All rights reserved.

 @date 2020-4-1

 @version v6.0

 FlexE technology refer to the Ethernet interface define by standard IEEE802.3 by binding one or more channels, and
 using 66B encoding as the basic unit for channelization processing, supporting multiple flexible rate and flexible
 Ethernet MAC technology.
 \b
 FlexE Shim
 \pp
  FlexE Shim is a logic layer inserted between the MAC and PHY of the traditional Ethernet architecture, realizing
  through the Calendar based slot distribution mechanism.
 \p
 \b
 FlexE Group
 \pp
  FlexE Group is traditional PHY layer defined by standard IEEE802.3, means one or more FlexE Instances, these Instances
  are carried on the same channel formed by bonding 1 to m Etherner PHYS.
 \p
 \b
 FlexE Client
 \pp
 FlexE Client corresponding to various user interfaces of the network, consistent with traditional service interface in
 the existing IP/Ethernet network.
 \p
 \b
 FlexE Instance
 \pp
  One 100G FlexE Instance represents a set of PHYS capable of carrying 100G data and a collection of Overhead related to
  them, every 200GBASE-R PHY or 400GBASE-R PHY carried two or foure 100G FlexE Instance.
 \p
 \b
 Serdes ID
 \pp
  Phisical channel used to intialize datapath, also in centec FlexE realize, Serdes ID is used as FlexE PHY.
 \p
 \b
*/

#ifndef _CTC_USW_FLEXE_H
#define _CTC_USW_FLEXE_H
#ifdef __cplusplus
extern "C" {
#endif

/****************************************************************************
 *
 * Header Files
 *
****************************************************************************/
#include "ctc_flexe.h"

/****************************************************************************
*
* Defines and Macros
*
****************************************************************************/

/****************************************************************************
 *
* Function
*
****************************************************************************/
/**
 @addtogroup flexe FLEXE
 @{
 */

/**
 @brief   Enable flexe function

 @param[in] lchip_id    local chip id

 @param[in] serdes_id    serdes id

 @param[in]  enable   enable or disable flexe function

 @remark[TMM] Enable or disable flexe function

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_set_en(uint8 lchip_id, uint16 serdes_id, uint8 enable);

/**
 @brief   Get flexe enable function

 @param[in] lchip_id    local chip id

 @param[in] serdes_id    serdes id

 @param[out]  enable   enable or disable flexe function

 @remark[TMM] Get Enable or disable flexe function

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_get_en(uint8 lchip_id, uint16 serdes_id, uint8* enable);

/**
 @brief   Create flexe group

 @param[in] lchip_id    local chip id

 @param[in] group_id    group id

 @param[in]  p_group   group param sturcture pointer

 @remark[TMM] Create flexe group

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_create_group(uint8 lchip_id, uint32 group_id, ctc_flexe_grp_t* p_group);

/**
 @brief   Destroy flexe group

 @param[in] lchip_id    local chip id

 @param[in] group_id    group id

 @remark[TMM] Destroy flexe group

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_destroy_group(uint8 lchip_id, uint32 group_id);

/**
 @brief   Get flexe group information

 @param[in] lchip_id    local chip id

 @param[in] group_id    group id

 @param[out]  p_group   group information sturcture pointer

 @remark[TMM] Get flexe group information

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_get_group(uint8 lchip_id, uint32 group_id, ctc_flexe_grp_t* p_group);

/**
 @brief   Set flexe group property

 @param[in] lchip_id    local chip id

 @param[in] group_id    group id

 @param[in] group_prop    group property

 @param[in] p_value   property value

 @remark[TMM] Set flexe group property

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_set_group_property(uint8 lchip_id, uint32 group_id, ctc_flexe_grp_prop_t group_prop, void* p_value);

/**
 @brief   Get flexe group property

 @param[in] lchip_id    local chip id

 @param[in] group_id    group id

 @param[in] group_prop    group property

 @param[out] p_value   property value

 @remark[TMM] Get flexe group property

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_get_group_property(uint8 lchip_id, uint32 group_id, ctc_flexe_grp_prop_t group_prop, void* p_value);

/**
 @brief   Add flexe client

 @param[in] lchip_id    local chip id

 @param[in] client_id    client id

 @param[in]  p_client   client param sturcture pointer

 @remark[TMM] Add flexe client

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_add_client(uint8 lchip_id, uint32  client_id, ctc_flexe_client_t* p_client);

/**
 @brief   Remove flexe client

 @param[in] lchip_id    local chip id

 @param[in] client_id    client id

 @remark[TMM] Remove flexe client

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_remove_client(uint8 lchip_id, uint32  client_id);

/**
 @brief   Get flexe client

 @param[in] lchip_id    local chip id

 @param[in] client_id    client id

 @param[out]  p_client   client information sturcture pointer

 @remark[TMM] Get flexe client

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_get_client(uint8 lchip_id, uint32  client_id, ctc_flexe_client_t* p_client);

/**
 @brief   Set flexe client property

 @param[in] lchip_id    local chip id

 @param[in] client_id    client id

 @param[in] client_prop    client property

 @param[in] p_value   property value

 @remark[TMM] Set flexe client property

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_set_client_property(uint8 lchip_id, uint32  client_id, ctc_flexe_client_prop_t client_prop, void* p_value);

/**
 @brief   Get flexe client property

 @param[in] lchip_id    local chip id

 @param[in] client_id    client id

 @param[in] client_prop    client property

 @param[out] p_value   property value

 @remark[TMM] Get flexe client property

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_get_client_property(uint8 lchip_id, uint32  client_id, ctc_flexe_client_prop_t client_prop, void* p_value);

/**
 @brief Get client link up status

 @param[in] lchip_id    local chip id

 @param[in]  client_id    client id

 @param[out] p_is_up  0 means not link up, 1 means link up

 @remark[TMM]  Get client link up status

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_get_client_link_up(uint8 lchip_id, uint32  client_id, bool* p_is_up);

/**
 @brief Set felxe client cross connect

 @param[in] lchip_id    local chip id

 @param[in]  p_cross   cross connect sturcture pointer

 @remark[TMM]  Set felxe client cross connect

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_set_client_cross(uint8 lchip_id, ctc_flexe_cross_t* p_cross);

/**
 @brief Get felxe client cross connect

 @param[in] lchip_id    local chip id

 @param[out]  p_cross   cross connect sturcture pointer

 @remark[TMM]  Get felxe client cross connect

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_get_client_cross(uint8 lchip_id, ctc_flexe_cross_t* p_cross);

/**
 @brief   Set flexe phy property

 @param[in] lchip_id    local chip id

 @param[in] serdes_id    serdes id

 @param[in] phy_prop    phy property

 @param[in] p_value   property value

 @remark[TMM] Set flexe phy property

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_set_phy_property(uint8 lchip_id, uint16 serdes_id, ctc_flexe_phy_prop_t phy_prop, void* p_value);

/**
 @brief   Get flexe phy property

 @param[in] lchip_id    local chip id

 @param[in] serdes_id    serdes id

 @param[in] phy_prop    phy property

 @param[out] p_value   property value

 @remark[TMM] Get flexe phy property

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_get_phy_property(uint8 lchip_id, uint32  serdes_id, ctc_flexe_phy_prop_t phy_prop, void* p_value);

/**
 @brief   Initialization for flexe module

 @param[in] lchip    local chip id

 @param[in] p_cfg global configuration for flexe pointer

 @remark[TMM] Initialization for flexe module

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_init(uint8 lchip, void* p_cfg);


/**
 @brief   Deinit for flexe module

 @param[in] lchip    local chip id

 @remark[TMM] Deinit for flexe module

 @return CTC_E_XXX

*/
extern int32
ctc_tmx_flexe_deinit(uint8 lchip);

/**@} end of @addtogroup flexe FLEXE*/
#ifdef __cplusplus
}
#endif

#endif

